<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <script type="text/javascript">
        var ctx = "${ctx}";
    </script>
	<%@ include file="/static/pages/common.jsp" %>

    <style type="text/css">
    	table{font-size:12px;}
    	.content-box{height:180px;width:100%;overflow-x:hide;overflow-y:auto;}
    	.szdj-table{width:420px;border-collapse: collapse;margin-top:10px;margin-left:40px;}
    	.szdj-table tr{height:32px;line-height:32px;}
    	.szdj-table .label_td{width:35%;padding-right:10px;text-align:right;border:1px solid #CBD5DE;}
    	.szdj-table .field-td{width:59%;text-align:left;border:1px solid #CBD5DE;}
    	.szdj-table .field-td select{border:0;outline:0;width:100%;height:100%;padding-left:8px;}
    	.szdj-table .field-td input{border:0;outline:0;width:95%;height:100%;padding-left:10px;}
    	.btn-box{width:420px;margin-top:20px;margin-left:14px;text-align:right;}
    	
    
    </style>
    <title>修改密码</title>
</head>
<body>
<div class="content-box">
	<form id="upmmForm" action="">
	<input type="hidden" id="judge" name="judge"   value="${judge }" />
		<table id="szdjTable" class="szdj-table">
		  <tr><td></td></tr>
			<tr id="szrd_tr">
				<td class="label_td">原密码：</td>
				<td class="field-td">
					<input type="password" id="oldpwd" name="oldpwd"   maxlength="15" />
				</td>
				<td></td>
			</tr>
			<tr id="szrd_tr">
				<td class="label_td">新密码：</td>
				<td class="field-td">
					<input type="password" id="newpwd" name="newpwd"    maxlength="15"/>
				</td>
				<td></td>
			</tr>
        	<tr id="szrd_tr">
				<td class="label_td">确认密码：</td>
				<td class="field-td">
					<input type="password" id="anonewpwd" name="anonewpwd"    maxlength="15"/>
				</td>
				<td></td>
			</tr>
		</table>
	</form>
</div>
<div class="btn-box">
	<button type="submit" class="_masterbtn" onclick="javascritp:xxgmm()">保存</button>
	<button type="button" class="_btn" onclick="window.parent.qyClose();">关闭</button>
</div>
 <script type="text/javascript">
    /**
     * 密码修改执行保存
     */
    function xxgmm() {
    	var oldpwd = $("#oldpwd").val();
    	var newpwd = $("#newpwd").val();
    	var anonewpwd = $("input[type=password]:eq(2)").val()
    	if(oldpwd == '') {
    		layer.tips("原密码必填项！", "#oldpwd");
    		$("#newpwd").focus();
    		return;
    	}
    	if(oldpwd.length < "6") {
    		layer.tips("密码最少6位！", "#oldpwd");
    		$("#newpwd").focus();
    		return;
    	}
    	if(newpwd == '') {
    		layer.tips("新密码必选项！", "#newpwd");
    		$("#newpwd").focus();
    		return;
    	}
    	if(newpwd.length < "6") {
    		layer.tips("密码最少6位！", "#newpwd");
    		$("#newpwd").focus();
    		return;
    	}
    	if(anonewpwd == '') {
    		layer.tips("确认密码必选项！", "#anonewpwd");
    		$("#anonewpwd").focus();
    		return;
    	}
    	
     	if(anonewpwd.length < "6") {
    		layer.tips("密码最少6位！", "#anonewpwd");
    		$("#anonewpwd").focus();
    		return;
    	}
    	
    	if(newpwd!=anonewpwd){
    		layer.tips("两次输入的密码不一致！","#anonewpwd");
    		return;
    	}
    	
    	
    	qyConfirm("确定要执行保存吗？", function(){
    		var judge  =  $("#judge").val();
    	    var b = new Base64();  
    	    var url = ctx + '/xtwh/rygl/upd_Mm?oldpwd='+ b.encode(oldpwd)+'&newpwd='+b.encode(newpwd)+'&judge='+judge+'&random='+Math.random();
    		var result = doFormService(url, "upmmForm");
    		if(result=="0") {
    			qyAlert("修改密码成功！",function(){
    				window.parent.qyClose();
    			});
    		}else{
		    	 qyError("原密码输入不正确");
			        return; 
		         }
    	      });
      }
 </script>
</body>
</html>